import { ref } from 'vue'
import { screenRank } from '@/api/screen'

export default function useLeverEnterprises() {
  const lists = ref<{
    name: string
    value: string | number
    [key: string]: any
  }[]>([])

  const getLeverEnterprises = async () => {
    try {
      const res = await screenRank()
      lists.value = (res.data || []).map((v: any) => ({
        name: v.enterpriseName,
        value: v.companiesOutput,
        data: { ...v },
      }))
    }
    catch (e) {
      console.warn(e)
    }
  }

  return {
    lists,
    getLeverEnterprises,
  }
}
